<include file="Common:header" title="服务类型"/>
<link href="__PUBLIC__/assets/css/plugins/blueimp/css/blueimp-gallery.min.css" rel="stylesheet">
<link href="__PUBLIC__/assets/css/plugins/footable/footable.core.css" rel="stylesheet">
<style>
    .title{overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 1;-webkit-box-orient: vertical;}
    .mytable {
        table-layout: fixed;
        width: 100%;
    }
</style>
<div id="wrapper">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">

                <div class="ibox float-e-margins">
                    <div class="ibox-title"><h5>服务类型列表</h5></div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="col-xs-12 col-sm-2">
                                    <a href="{:U('Service/add_service_type')}">
                                        <button class="btn btn-danger">
                                            <i class="ace-icon glyphicon glyphicon-plus"></i>
                                            添加服务类别
                                        </button>
                                    </a>
                                </div>
                                <div class="col-xs-12 col-sm-5">
                                </div>
                                <div class="input-group-btn">

                                </div>
                            </div>
                        </div>
                        <div class="table-responsive"><br/>

                            <table width="100%" class="table table-bordered table-hover mytable">
                                <thead>
                                <tr>
                                    <th width="5%">ID</th>
                                    <th width="30%">服务名称</th>
                                    <th width="20%">添加时间</th>
                                    <th width="10%">操作</th>

                                </tr>
                                </thead>

                                <tbody>
                                <foreach name="data" item="v">
                                    <tr>
                                        <td height="28" >{$v.id}</td>
                                        <td><div class="title" style="cursor:pointer" onclick="detailed(this)">{$v.name}</div></td>

                                        <td>
                                            {$v.add_time|date='Y-m-d H:i:s',###}
                                        </td>
                                        <td>
                                            <a style="margin:0;" class="btn btn-xs btn-info"  href="{:U('Service/edit_service_type',array('id'=>$v['id']))}">
                                                <i class="fa fa-pencil" style="font-size: 14px;"></i>&nbsp;编辑</a>
                                            <a class="red" href="javascript:;" onclick="del({$v.id})"  title="删除">
                                                <span class="label label-danger">删除</span>
                                            </a>
                                        </td>

                                    </tr>
                                    </tr>
                                </foreach>
                                <tr>
                                    <td height="50" colspan="11" align="right">{$page}</td>
                                </tr>
                                </tbody>

                            </table>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="blueimp-gallery" class="blueimp-gallery">
    <div class="slides"></div>
    <h3 class="title"></h3>
    <a class="prev">‹</a>
    <a class="next">›</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
</div>
<include file="Common:footer"/>
<script src="__PUBLIC__/assets/js/plugins/blueimp/jquery.blueimp-gallery.min.js"></script>
<script src="__PUBLIC__/assets/js/plugins/footable/footable.all.min.js"></script>
<script>

    function del(id) {
        layer.confirm('你确定要删除？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            window.location.href="__URL__/del_service_type/id/"+id;
        });
    }

    function change(id,btn) {
        $.post("{:U('Service/top_status')}",{id:id},function (data) {
            $(btn).text(data.info);
            if(data.info=='置顶'){
                $(btn).removeClass('btn-danger');
                $(btn).addClass('btn-primary');
            }else{
                $(btn).removeClass('btn-primary');
                $(btn).addClass('btn-danger');
            }
        });
    }
    function detailed(obj) {
        if(obj.getAttribute('class')=='title'){
            var reg = new RegExp('(\\s|^)title(\\s|$)');
            obj.className = obj.className.replace(reg, ' ');
        }
        else{
            obj.className = "title";
        }
    }
</script>
